package umg.os.devices;

import java.io.IOException;
import java.nio.file.Paths;

import umg.os.devices.filesystem.UMGFileSystem;
import umg.os.devices.filesystem.basic.BasicFileSystem;
import umg.os.devices.filesystem.basic.BasicFileSystem.DataOversizedException;
import umg.os.devices.filesystem.basic.HDDHandler.VolumeUnavailableException;
import umg.os.devices.filesystem.logical.File;

public class TempMain {

	/*public void menu() {
		Scanner sn = new Scanner(System.in);
		short option;
		Path path = Paths.get("/Users/cesaralonsomartinezsanchez/Desktop/archivo2.hd");
		System.out.println("Opening: "+path);
		//HDDHandler driver = new HDDHandler(path);
		do {
			System.out.println("1.- Read files metadata");
			System.out.println("2.- Create directory");
			System.out.println("3.- Exit");
			option = sn.nextShort();
			switch (option) {
			case 1:
				byte[] data = driver.readData(76800);
				byte[] firstCachito = new byte[254];
				System.arraycopy(data, 0, firstCachito, 0, 254);
				System.out.println(new FileControlBlock(firstCachito)); 
				break;
			case 2:
				
				break;
			default:
				
				break;
			}
		} while (option != 3);
	}*/
	
	/**
	 * @param args
	 * @throws IOException 
	 * @throws VolumeUnavailableException 
	 * @throws DataOversizedException 
	 */
	public static void main(String[] args) throws IOException, DataOversizedException, VolumeUnavailableException {
		//new TempMain().menu();
		
		//UMGFileSystem.createNewVolume(Paths.get("/Users/cesaralonsomartinezsanchez/Desktop/archivo2.hd"));
		UMGFileSystem umgfs = UMGFileSystem.mount(Paths.get("/Users/cesaralonsomartinezsanchez/Desktop/archivo2.hd"));
		//umgfs.mkdir("hola");
		//umgfs.cd("hola");
		//umgfs.mkdir("bin");
		//umgfs.mkFil("/hola/usrlst.ls");
		
		File f = umgfs.open("/hola/usrlst.ls");
		byte[] hola = {(byte)'h', (byte)'o', (byte)'l', (byte)'a'};
		f.append(hola);
		f.save();
		
		//UMGFileSystem.mount(Paths.get("C:/Users/Strudent/Desktop/archivo2.hd"));
		//UMGFileSystem.createNewVolume(Paths.get("C:/Users/Strudent/Desktop/archivo2.hd"));
		//DataManipulationUtilities.intTo3BytesArray(-1);
	}

}
